﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KPIS.GERP.GHRMS.DAL;

namespace KPIS.GERP.GHRMS.BLL
{
    public class TrainingScholarshipBLL
    {
        private static readonly TrainingScholarshipDAL dal = new TrainingScholarshipDAL();
        ConvertNullable cn = new ConvertNullable();

        public DataSet GetData(string scholar_seq)
        {
            Nullable<int> ischolar_seq = cn.ConvertNullInt(scholar_seq);
            return dal.GetData(ischolar_seq);
        }

        public void Insert(string scholar_descr, string scholar_type_seq, string scholar_fund_seq1, string scholar_fund_seq2 
                            , string edu_degree_seq, string country_seq, string epc_seq, string amount, int closed, DateTime date_sign_start
                            , DateTime date_sign_end, string edu_year_end, string edu_year_start, string created_by)
        {
            int ischolar_type_seq = Convert.ToInt32(scholar_type_seq);
            int ischolar_fund_seq1 = Convert.ToInt32(scholar_fund_seq1);
            Nullable<int> ischolar_fund_seq2 = cn.ConvertNullInt(scholar_fund_seq2);
            int iedu_degree_seq = Convert.ToInt32(edu_degree_seq);
            int icountry_seq = Convert.ToInt32(country_seq);
            Nullable<int> iepc_seq = cn.ConvertNullInt(epc_seq);
            int iamount = Convert.ToInt32(Convert.ToDecimal(amount));
            Nullable<int> icreated_by = cn.ConvertNullInt(created_by);

            dal.Insert(scholar_descr, ischolar_type_seq, ischolar_fund_seq1, ischolar_fund_seq2, iedu_degree_seq, icountry_seq
                       , iepc_seq, iamount, closed, date_sign_start, date_sign_end, edu_year_end, edu_year_start, icreated_by);
        }

        public void Update(string scholar_seq, string scholar_descr, string scholar_type_seq, string scholar_fund_seq1, string scholar_fund_seq2
                           , string edu_degree_seq, string country_seq, string epc_seq, string amount, int closed, DateTime date_sign_start
                           , DateTime date_sign_end, string edu_year_end, string edu_year_start, string created_by)
        {
            int ischolar_seq = Convert.ToInt32(scholar_seq);
            int ischolar_type_seq = Convert.ToInt32(scholar_type_seq);
            int ischolar_fund_seq1 = Convert.ToInt32(scholar_fund_seq1);
            Nullable<int> ischolar_fund_seq2 = cn.ConvertNullInt(scholar_fund_seq2);
            int iedu_degree_seq = Convert.ToInt32(edu_degree_seq);
            int icountry_seq = Convert.ToInt32(country_seq);
            Nullable<int> iepc_seq = cn.ConvertNullInt(epc_seq);
            int iamount = Convert.ToInt32(Convert.ToDecimal(amount));
            Nullable<int> icreated_by = cn.ConvertNullInt(created_by);

            dal.Update(ischolar_seq, scholar_descr, ischolar_type_seq, ischolar_fund_seq1, ischolar_fund_seq2, iedu_degree_seq, icountry_seq
                       , iepc_seq, iamount, closed, date_sign_start, date_sign_end, edu_year_end, edu_year_start, icreated_by);
        }


        public void Delete(string scholar_seq, string UpdatedBy)
        {
            int ischolar_seq = Convert.ToInt32(scholar_seq);
            int iUpdatedBy = Convert.ToInt32(UpdatedBy);
            dal.Delete(ischolar_seq, iUpdatedBy);
        }
    }
}
